
// 1.导入useEffect
import React,{useEffect, useState} from 'react'

export default function App() {
 
  const [count,setCount] = useState(0)

  //2.调用useEffect
  //useEffect是一个自动执行的函数,生命周期的阶段会执行
  //语法: useEffect(回调函数)
  useEffect(()=>{
    console.log('我被执行了  ----->  ');
    console.log('count  ----->  ', count);
    document.title=count
  })
  return (
    <div >
     
    count --- {count}
      
    <button onClick={()=>setCount(count+1)}>点击改变count</button>
    </div>
  )
}


